package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AddressBookMapper {


    List<AddressBook> list(Long userId);

    void update(AddressBook book);

    void insert(AddressBook addressBook);
    @Select("select * from address_book where user_id = #{userId} and is_default = 1")
    AddressBook getDefault(Long currentId);
    @Select("SELECT * FROM address_book WHERE id = #{addressBookId}")
    AddressBook getById(Long addressBookId);
}
